              package com.java.diagnostics.visualizer.parser.vgc.converters;
              
              import com.java.diagnostics.visualizer.data.axes.UnitConverterDefinition;
              import com.java.diagnostics.visualizer.gc.defaultextensions.util.Messages;
              import com.java.diagnostics.visualizer.impl.axes.AbstractUnitConverter;
              import com.java.diagnostics.visualizer.impl.axes.UnitConverterDefinitionImpl;
              import com.java.diagnostics.visualizer.parser.vgc.constants.VGCAxes;
              import java.text.DateFormat;
              import java.text.DecimalFormat;
              import java.text.MessageFormat;
              import java.text.NumberFormat;
              import java.text.ParseException;
              import java.text.SimpleDateFormat;
              import java.util.Date;
              
              public class DaysUnitConverter extends AbstractUnitConverter
              {
                private double normalisationOffset;
                private final DateFormat normalisedFormat = new SimpleDateFormat(
                  Messages.getString("DateUnitConverter.normalised.date.format"));
              
                private static final MessageFormat normalisedTimeFormat = new MessageFormat(
                  Messages.getString("DateUnitConverter.normalised.timestamp.format"));
                private static final long extraNormalisationOffset = 3600000L;
                private static final UnitConverterDefinition definition = new UnitConverterDefinitionImpl(
                  VGCAxes.MILLISECONDS, VGCAxes.DAYS, VGCAxes.DAYS, false);
              
                public double convert(double number)
                {
                  return number - this.normalisationOffset;
                }
              
                public String formatUnconverted(double number)
                {
                  long milliseconds = Math.round(number);
              
                  long time = milliseconds / 1000L;
                  time += 86400L;
                  long days = time / 86400L;
                  long hours = time % 86400L / 3600L;
                  long minutes = time % 3600L / 60L;
                  long seconds = time % 60L;
              
                  NumberFormat nformat = new DecimalFormat();
                  nformat.setMinimumIntegerDigits(2);
                  return normalisedTimeFormat.format(new Object[] { 
                    nformat.format(hours), nformat.format(minutes), 
                    nformat.format(seconds), days });
                }
              
                public String formatUnconverted(double number, int fractionalDigits)
                {
                  return formatUnconverted(number);
                }
              
                public double parseUnconverted(String date)
                {
                  try
                  {
                    return this.normalisedFormat.parse(date).getTime() + 3600000L;
                  }
                  catch (ParseException localParseException) {
                  }
                  return 0.0D;
                }
              
                public UnitConverterDefinition getDefinition()
                {
                  return definition;
                }
              
                public void setOffset(double offset)
                {
                  this.normalisationOffset = offset;
                }
              
                protected String getFormatWithUnitsPattern()
                {
                  return "{0}";
                }
              }

